35#include "yaml-schema-cpp/yaml_server.hpp"
55#define WOLF_MAP_CREATE(MapClass) \
56 static MapBasePtr create(const YAML::Node& _input_node, const std::vector<std::string>& _folders_schema = {}) \
59 if (not _folders_schema.empty()) \
61 auto server = yaml_schema_cpp::YamlServer(_folders_schema); \
62 server.setYaml(_input_node); \
63 if (not server.applySchema(#MapClass)) \
65 WOLF_ERROR(server.getLog()); \
68 map = std::shared_ptr<MapClass>(new MapClass(server.getNode())); \
71 map = std::shared_ptr<MapClass>(new MapClass(_input_node)); \
72 if (_input_node["landmarks"]) \
74 for (unsigned int i = 0; i < _input_node["landmarks"].size(); i++) \
76 LandmarkBasePtr lmk_ptr = \
77 FactoryLandmark::create(_input_node["landmarks"][i]["type"].as<std::string>(), \
78 _input_node["landmarks"][i], \
85 static MapBasePtr create(const std::string& _yaml_filepath, const std::vector<std::string>& _folders_schema) \
87 auto server = yaml_schema_cpp::YamlServer(_folders_schema, _yaml_filepath); \
88 if (not server.applySchema(#MapClass)) \
90 WOLF_ERROR(server.getLog()); \
93 return create(server.getNode(), {}); \
103 LandmarkBasePtrList landmark_list_;
112 MapBase(
const YAML::Node& _params);
116 MapBase(
const std::string& _type,
const YAML::Node& _params);
127 virtual LandmarkBasePtr
addLandmark(LandmarkBasePtr _landmark_ptr);
144 LandmarkBaseConstPtr
getLandmark(
const unsigned int& _id)
const;
148 LandmarkBasePtr
getLandmark(
const unsigned int& _id);
152 virtual void load(std::string _map_file_yaml);
156 virtual bool save(std::string _map_file_yaml,
const std::string& _map_name =
"")
const;
164 std::ostream& stream,
165 std::string _tabs =
"")
const;
169 virtual void print(
int depth,
173 std::ostream& stream = std::cout,
174 std::string _tabs =
"")
const;
178 virtual CheckLog localCheck(
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
182 virtual bool check(
CheckLog& _log,
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
187 LandmarkBaseConstPtrList list_const;
188 for (
auto&& obj_ptr : landmark_list_) list_const.push_back(obj_ptr);
194 return landmark_list_;
Log of a consistency check: whether it is consistent and the explanation of the inconsistencies.
Definition: check_log.h:30
Base class of landmarks: elements of the map with state blocks, observed from the frames.
Definition: landmark_base.h:93
Base class of maps: container of the landmarks.
Definition: map_base.h:99
virtual bool check(CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node and its children, composing the log.
Definition: map_base.cpp:167
~MapBase() override=default
MapBase()
Default constructor.
Definition: map_base.cpp:29
virtual void print(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
Prints this node and, depending on the depth, its children.
Definition: map_base.cpp:139
virtual bool save(std::string _map_file_yaml, const std::string &_map_name="") const
Saves the landmarks to a YAML map file. Returns whether it succeeded.
Definition: map_base.cpp:91
virtual CheckLog localCheck(bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node (not of its children)
Definition: map_base.cpp:152
virtual void printHeader(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
Prints the information of this node (not of its children)
Definition: map_base.cpp:128
LandmarkBaseConstPtr getLandmark(const unsigned int &_id) const
Returns the landmark with a given id (nullptr if not found)
Definition: map_base.cpp:51
LandmarkBaseConstPtrList getLandmarkList() const
Returns the landmarks of the map.
Definition: map_base.h:185
virtual LandmarkBasePtr addLandmark(LandmarkBasePtr _landmark_ptr)
Adds a landmark to the list of landmarks.
Definition: map_base.cpp:40
virtual void removeLandmark(LandmarkBasePtr _landmark_ptr)
Removes a landmark from the list of landmarks.
Definition: map_base.cpp:46
bool hasChildren() const override
Returns whether the node has children in the Wolf tree.
Definition: map_base.cpp:35
virtual void load(std::string _map_file_yaml)
Creates the landmarks of a YAML map file and links them to the map.
Definition: map_base.cpp:69
Base class for Nodes.
Definition: node_base.h:73
Definition: capture_base.h:23